/// @tags: Matrix
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#define rint register int

using std::cin;
using std::cout;

namespace BlueQuantum {

typedef long long LL;

constexpr int MAXN = 2.5e2 + 3, MAXK = 2e2 + 3, LG = 31;

int n, m, t, k;
int id[MAXN][6], c[MAXN];

struct Festival {
  int t, x, y;
  inline bool operator<(const Festival &rhs) const { return t < rhs.t; }
} f[MAXK];

struct Vector;
struct Matrix;

struct Vector {
  static int n;
  LL a[MAXN];

  inline Vector() { memset(a, -0x3f, sizeof(a)); }

  inline LL &operator[](int index) { return a[index]; }
  inline const LL &operator[](int index) const { return a[index]; }

  Vector operator*(const Matrix &rhs) const;
} A;

struct Matrix {
  static int n;
  Vector a[MAXN];

  inline Vector &operator[](int index) { return a[index]; }
  inline const Vector &operator[](int index) const { return a[index]; }

  Matrix operator*(const Matrix &rhs) const;
  Matrix operator^(int exp) const;
} T[LG];

int Vector::n, Matrix::n;

inline Vector Vector::operator*(const Matrix &rhs) const {
  Vector res;
  for (rint i = 1; i <= n; ++i) {
    for (rint j = 1; j <= n; ++j) res[i] = std::max(res[i], a[j] + rhs[j][i]);
  }
  return res;
}

inline Matrix Matrix::operator*(const Matrix &rhs) const {
  Matrix res;
  for (rint i = 1; i <= n; ++i) res[i] = a[i] * rhs;
  return res;
}

inline Matrix Matrix::operator^(int exp) const {
  Matrix res, base(*this);
  for (; exp; exp >>= 1, base = base * base)
    if (exp & 1) res = res * base;
  return res;
}

inline int main() {
  cin >> n >> m >> t >> k;
  int tot = n;
  for (int i = 1; i <= n; ++i) cin >> c[i];
  for (int i = 1; i <= n; ++i) id[i][0] = i;
  for (int i = 1; i <= m; ++i) {
    int u, v, w;
    cin >> u >> v >> w;
    for (int j = 1; j < w; ++j)
      if (id[u][j] == 0) id[u][j] = ++tot;
    for (int j = 1; j < w; ++j) T[0][id[u][j - 1]][id[u][j]] = 0;
    T[0][id[u][w - 1]][v] = c[v];
  }
  for (int i = 1; i <= k; ++i) cin >> f[i].t >> f[i].x >> f[i].y;
  std::sort(f + 1, f + k + 1);
  f[0] = Festival{0, 0, 0}, f[k + 1] = Festival{t, 0, 0};
  Vector::n = Matrix::n = tot;
  for (int i = 1; i < LG; ++i) T[i] = T[i - 1] * T[i - 1];
  A[1] = c[1];
  for (int i = 1; i <= k + 1; ++i) {
    int dt = f[i].t - f[i - 1].t;
    for (int j = LG - 1; j >= 0; --j)
      if (dt >> j & 1) A = A * T[j];
    A[f[i].x] += f[i].y;
  }
  if (A[1] < 0)
    cout << "-1";
  else
    cout << A[1];
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P6772 [NOI2020] 美食家.in", "r", stdin);
  freopen("P6772 [NOI2020] 美食家.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
